package com.taotao.complier.calcu.ast;

import com.taotao.complier.calcu.visit.Visitor;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class TermNode implements AstNode {

    // term ->  factor  term2 |  ε

    private FactorNode factor;

    private Term2Node term2;

    @Override
    public void accept(Visitor visitor) {

        if (null != factor) {
            factor.accept(visitor);
        }

        if (null != term2) {
            term2.accept(visitor);
        }


        visitor.visitTerm(this);
    }
}
